package org.dding.core.system.datasource;

import java.sql.SQLException;

import org.dding.core.system.handler.DataSourceConfiguration;

public class DataSource {

	public javax.sql.DataSource datasource;
	public DataSourceConfiguration name;

	public javax.sql.DataSource getDatasource() {
		return datasource;
	}

	public DataSourceConfiguration getName() {
		return name;
	}

	public DataSource(javax.sql.DataSource datasource,
			DataSourceConfiguration name) {
		super();
		this.datasource = datasource;
		this.name = name;
	}

	public boolean isConnection() {
		if (datasource == null)
			return false;
		try {
			return !datasource.getConnection().isClosed();
		} catch (SQLException e) {
			e.printStackTrace();
			return false;
		}
	}
}
